#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <map>
#include <math.h>

using namespace std;


bool checkArmstrong(int v){
	map<char, int> mp;
	mp['0'] = 0;
	mp['1'] = 1;
	mp['2'] = 2;
	mp['3'] = 3;
	mp['4'] = 4;
	mp['5'] = 5;
	mp['6'] = 6;
	mp['7'] = 7;
	mp['8'] = 8;
	mp['9'] = 9;

	char p[32];
	sprintf(p, "%d", v);
	int power = strlen(p);

	int sum = 0;
	for(int i=0; i < power; i++){
		sum += pow(mp[p[i]], power);
	}

	printf("sum = %d , power = %d\n", sum , power);
}

int main(){
	checkArmstrong(153);
	return 0;
}
